<?php
namespace backend\controllers;

use Yii;
use yii\web\Controller;
use backend\models\Admin;
/**
 * Site controller
 */
class CommonController extends Controller{

    // public $layout=true;//关闭

	public function init(){//继承
		   parent::init();
		   $session=Yii::$app->session;
	       $session->open();

		if(empty($session['username'])){
			 Yii::$app->getSession()->setFlash('error',"请登录后进入后台管理界面");
			 return $this->redirect('index.php?r=index/login');
		   }
	}
	
}
?>